# -*- coding: utf-8 -*-
# @Time    : 2023/5/20 16:34
# @Author  : Pan
# @Software: PyCharm
# @Project : VisualFramework
# @FileName: SimMIM

image_size = (224, 224)
max_steps = int(5e5)

config = {
    "type": "MAE",
    "base_info": {
        "step": max_steps,
        "dot": 500,
        "save_iters": 5000,
        "pretrained": None,
        "save_path": "output/",
        "log_dir": "log_dir/",
    },
    "train_dataset": {
        "type": "MAEDataset",
        "batch_size": 42,
        "shuffle": True,
        "num_workers": 2,
        "data_root": "dataset",
        "transforms": [
            {
                "type": "LoadData",
                "keys": ["img"],
                "func": "cv2"
            },
            {
                "type": "ResizeByShort",
                "keys": ["img"],
                "short": [i for i in range(224, 512, 1)],
                "inter": ["bilinear"]
            },
            {
                "type": "RandPaddingCrop",
                "keys": ["img"],
                "pad_size": image_size,
                "crop_size": image_size
            },
            {
                "type": "ToTensor",
                "keys": ["img"]
            },
            {
                "type": "Normalize",
                "keys": ["img"],
                "mean": 0.5,
                "std": 0.5
            }
        ]
    },
    "optimizer": {
        "type": "adam",
        "lr_scheduler": {
            "type": "WarmupCosineLR",
            "learning_rate": 0.0005,
            "total_steps": max_steps,
            "warmup_steps": 10000,
            "warmup_start_lr": 1e-7,
            "end_lr":1e-7
        },
        "decay": None
    },
    "network": {
        "type": "mae",
        "network": {
            "type": "SwinTransformer_base_patch4_window7_224"
        }
    },
    "loss": {
        "loss_list": [
            {
                "type": "SimMIMLoss"
            }
        ],
        "loss_coef": [1]
    }
}